<template>
  <div>
    <TbTitle level="3" title="（3）对外交流合作项目（含分支、代表机构开展的合作项目）" />
    无此情况：<el-switch inline-prompt v-model="yes1" disabled active-text="有" inactive-text="无">
    </el-switch>

    <el-table size="mini" :header-cell-style="{ background: '#f0f7fc', color: '#000' }" :data="tableData1" border>
      <el-table-column type="index" align="center" width="70" label="序号">
      </el-table-column>
      <el-table-column prop="projectName" align="center" label="项目名称">
      </el-table-column>
      <el-table-column prop="projectExpenditure" align="center" label="项目支出(人民币万元)">
      </el-table-column>
      <el-table-column prop="institutionCountry" align="center" label="实施国家(地区)">
      </el-table-column>
    </el-table>
    <div class="msg-tip">
      注：项目不包括会议、考察、访问等非项目性的一次性活动。
    </div>
  </div>
  <div>
    <TbTitle level="3" title="（4）参加国际组织（含分支、代表机构参加的境外组织）" />
    无此情况：<el-switch inline-prompt v-model="yes2" disabled active-text="有" inactive-text="无">
    </el-switch>
    <el-table size="mini" :header-cell-style="{ background: '#f0f7fc', color: '#000' }" :data="tableData2" border>
      <el-table-column type="index" align="center" width="70" label="序号">
      </el-table-column>
      <el-table-column prop="organizationName" align="center" label="国际组织名称（中、英文全称）">
      </el-table-column>
      <el-table-column prop="organizationType" align="center" label="国际组织类型">
        <template v-slot="scope">
          {{ dictToVal(dict1, scope.row.organizationType) }}
        </template>
      </el-table-column>
      <el-table-column prop="participateTime" align="center" label="参加时间">
      </el-table-column>
      <el-table-column prop="qualification" align="center" label="担任职务或获得资格情况">
      </el-table-column>
    </el-table>
    <div class="msg-tip">
      <p>注：1、本栏目统计本单位截止{{ examineYear }}年年底仍然有效参加的所有国际组织。</p>
      <p>
        2、职务或资格类型包括：会员、担任国际组织分支机构具体职务、担任国际组织具体职务、获得国际组织某种资格或认可（如谘商地位、建立正式官方关系）等。
      </p>
    </div>
  </div>
</template>

<script setup lang="ts">
import TbTitle from '@/views/yearCheck/components/TbTitle.vue'
import { ref, inject, reactive } from 'vue'
import { getDictInternationalOrg } from '@/api/dict/index'
let yes1 = ref(false)
let yes2 = ref(false)
let tableData1 = ref([])
let tableData2 = ref([])
let examineYear = ref()

const dict1 = ref([])

const { getDetailInfo } = inject('getDetailInfo')

getDetailInfo().then(res => {
  examineYear.value = res.examineYear
  const { foreignList, internationalList } = res.data

  tableData1.value = foreignList ?? []
  tableData2.value = internationalList ?? []
  yes1.value = foreignList && foreignList.length > 0 ? true : false
  yes2.value = internationalList && internationalList.length > 0 ? true : false
})

let getDictInfo = () => {
  //国际组织类型
  getDictInternationalOrg().then(res => {
    dict1.value = res.data
  })
}
getDictInfo()

const dictToVal = (dictList, val) => {
  for (let i = 0; i < dictList.length; i++) {
    if (val == dictList[i].id) {
      return dictList[i].name
    }
  }
}
</script>
<style lang="scss" scoped>
.msg-tip {
  padding: 20px 0;
  color: #000;
  font-size: 12px;
  font-family: '微软雅黑';
}

::v-deep .el-descriptions__label.el-descriptions__cell.is-bordered-label {
  background: #f0f7fc;
}
</style>
